import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.Sheet;
import com.alibaba.excel.support.ExcelTypeEnum;
import main.ExcelListener;
import main.Info;
import org.junit.Test;

import java.io.*;

/**
 * Created by PuFan on 2019/2/27 23:04 /Recruit
 */

public class ReadExcel {
    @Test
    public void testExcel2003WithReflectModel() throws FileNotFoundException {
        File file = new File("H:\\Recruit\\resource\\2019.xlsx");
        InputStream inputStream = new FileInputStream(file);
        try {
            AnalysisEventListener listener = new ExcelListener();
            ExcelReader excelReader = new ExcelReader(inputStream, ExcelTypeEnum.XLSX, null, listener);
            excelReader.read(new Sheet(1, 2, Info.class));
        } finally {
            try {
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
